/**********************************
The header file for module 2

**********************************/

#ifndef _r2_h
#define _r2_h

#include <stdio.h>
#include "commhand.h"

/**********************************
define statements

**********************************/
#define RUNNING 1
#define READY 0
#define BLOCKED -1
#define SUSPENDED_BLOCKED 2
#define SUSPENDED_READY -2
#define SYS 0
#define APP 1
#define FIFO 0
#define PRIORITY 1

/**********************************
PCB Struct
Written by Chad Rothermund, with no help from Brandon Strickland
Some from Billy Hardy, though
suspend if it's 0 then it's not suspended if 1 then it is

**********************************/
typedef struct PCB_t {
	char name[11];
	int classs;
	int priority;
	int states;
	unsigned char *top;
	unsigned char *base;
	struct PCB_t *next;
	struct PCB_t *prev;
} PCB;


/**********************************
Queue for PCBs

Author: Billy
**********************************/
typedef struct pcb_queue {
	int count;
	int state;
	PCB *head;
	PCB *tail;
} PCB_QUEUE;


/**********************************
Commands

**********************************/
int unblockPCB(int, char *[]);                      //Billy


/**********************************
Procedures

**********************************/

PCB *findPCB(char *PCBname);                            //works
int see(PCB *thingy, char *PCBname);                    //works
int createPCB(int argc, char *argv[]);                  //works
int insertPCB(PCB *ins, PCB_QUEUE *que, int insType);   //works
int deletePCB(int argc, char *argv[]);                  //works
int blockPCB(int argc, char *argv[]);                   //works
int unblockPCB(int argc, char *argv[]);                 //works
int suspendPCB(int argc, char *argv[]);                 //works
int resumePCB(int argc, char *argv[]);                  //works
int setPCBPriority(int argc, char *argv[]);             //works
int showPCB(int argc, char *argv[]);                    //works
void showPCBs(PCB *pc);                                 //works
int showReady(int argc, char *argv[]);                  //works
int showBlocked(int argc, char *argv[]);                //works
int showAll(int argc, char *argv[]);					//works
int removePCB(PCB* a);                                  //works
PCB *allocatePCB();                                     //works
void init_Queues();                                     //works
PCB_QUEUE* getQueue(int state);                         //works
PCB_QUEUE* getReadyQueue();
int helperRemove( PCB* b );

#endif